<%@page import="org.soenea.doitall.domain.model.person.Person"%>
<%@page import="org.soenea.doitall.domain.model.group.Group"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>View Group</title>
</head>
<body>
<h2>View Group</h2>
<p>
  <c:if test="${!empty warning}"> <b>Warning: </b> ${warning}<br />
  </c:if>
  ${group.name} with description ${group.description}</p>
  List of invites
  <c:forEach items="${group.members}" var="member">
    <%-- We could use "${pageContext.request.contextPath}/app/..." as part of the href. --%>
    <li>
      <form action="invite/${member.id}" method="post" id="delete${member.id}">
        <div> <a href="buddy/${member.invited.id}">${member.invited.userName}</a> with status <b>${member.status}</b>
          <input name="command" type="hidden" value="DeleteInvite"/>
          <input type="submit" name="button" id="button" value="Delete invite"/>
        </div>
      </form>
    </li>
  </c:forEach>
  
  <h3>Edit group:</h3>
<form id="EditGroupForm" method="post" action="">
  <fieldset>
    <legend>Group information</legend>
    <div>
    	<input type="text" name="groupID" id="groupID" value="${group.id}" style="display:none"  />
    </div>
    <div>
      <label>Name:
        <input type="text" name="name" id="name" value="${group.name }" />
      </label>
    </div>
    <div>
      <label>Description:
        <input type="text" name="description" id="description" value="${group.description }" />
      </label>
    </div>
    <input type="submit" name="submit" id="submit" value="Edit" />
    <input name="version" id="version" type="hidden" value="${group.version}"/>
    <input name="command" type="hidden" value="EditGroup" />
  </fieldset>
</form>
  
 Invite user to join the group
  <c:forEach items="${people}" var="person">
    <%-- We could use "${pageContext.request.contextPath}/app/..." as part of the href. --%>
    <li>
        <div> <a href="buddy/${person.id}">${person.userName}</a>
          <a href="../inviteUser/${person.id}/${group.id}">Invite user</a>
        </div>
    </li>
  </c:forEach>
<p> Return to <a href="../groups">browsing groups</a> </p>
</body>
</html>